//
//  ListRootViewController.swift
//  fruit-helper-swift
//
//  Created by 赵隆杰 on 2022/6/11.
//

import UIKit

class ListRootViewController: BaseViewController {
    
    var pageVc: ListPageViewController!

    override func viewDidLoad() {
        super.viewDidLoad()

        navigationItem.title = "列表"
        
        pageVc = ListPageViewController.init(viewControllerClasses: [ListViewController.self, ListViewController.self], andTheirTitles: ["阅读书单", "历史记录"])
        addChild(pageVc!)
        view.addSubview(pageVc.view)
        
    }
    
    override func viewDidLayoutSubviews() {
        let naviMaxY = navigationController!.navigationBar.frame.maxY
        let tabH = tabBarController!.tabBar.height
        pageVc.view.frame = CGRect(x: 0, y: naviMaxY, width: view.width, height: view.height - naviMaxY - tabH)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.navigationBar.prefersLargeTitles = false
    }
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        navigationController?.navigationBar.prefersLargeTitles = true
    }
    
}
